{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "#Importing PulP solver\n",
    "from pulp import *"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "#Inputing the Demand points\n",
    "demand_points=['Mina Salman','Port of Haifa']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['Mina Salman', 'Port of Haifa']"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "demand_points"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "#Inputing the Supply Points\n",
    "supply_points=['Port of Santos','Port of Montreal','Port of Vancouver','Port of Shanghai','Port of Marseille','Port of Bandar Abbas','Port of Haifa','Port of Aktau','Port of Busan','Penang Port','Port of Oslo','Port of Vladivostok','Port of Novorossiysk','Port of St. Petersburg','Port of Belgrade','Port of Mersin','Port of Odessa','Port of New York','Port of Los Angeles']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['Port of Santos',\n",
       " 'Port of Montreal',\n",
       " 'Port of Vancouver',\n",
       " 'Port of Shanghai',\n",
       " 'Port of Marseille',\n",
       " 'Port of Bandar Abbas',\n",
       " 'Port of Haifa',\n",
       " 'Port of Aktau',\n",
       " 'Port of Busan',\n",
       " 'Penang Port',\n",
       " 'Port of Oslo',\n",
       " 'Port of Vladivostok',\n",
       " 'Port of Novorossiysk',\n",
       " 'Port of St. Petersburg',\n",
       " 'Port of Belgrade',\n",
       " 'Port of Mersin',\n",
       " 'Port of Odessa',\n",
       " 'Port of New York',\n",
       " 'Port of Los Angeles']"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "supply_points"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "#Inputing the distances\n",
    "distance = dict(zip(supply_points,[dict(zip(demand_points, [9662,7667])),\n",
    "dict(zip(demand_points, [9594,6336])),\n",
    "dict(zip(demand_points, [15871,12461])),\n",
    "dict(zip(demand_points, [6882,8336])),\n",
    "dict(zip(demand_points, [5332,1946])),\n",
    "dict(zip(demand_points, [380,3310])),\n",
    "dict(zip(demand_points, [3621,0])),\n",
    "dict(zip(demand_points, [5279,2201])),\n",
    "dict(zip(demand_points, [7398,8852])),\n",
    "dict(zip(demand_points, [3856,5310])),\n",
    "dict(zip(demand_points, [7928,4539])),\n",
    "dict(zip(demand_points, [7981,9435])),\n",
    "dict(zip(demand_points, [5139,1715])),\n",
    "dict(zip(demand_points, [8787,5398])),\n",
    "dict(zip(demand_points, [5416,1994])),\n",
    "dict(zip(demand_points, [3831,233])),\n",
    "dict(zip(demand_points, [4957,1533])),\n",
    "dict(zip(demand_points, [9168,5756])),\n",
    "dict(zip(demand_points, [14552,11048]))]))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'Port of Santos': {'Mina Salman': 9662, 'Port of Haifa': 7667},\n",
       " 'Port of Montreal': {'Mina Salman': 9594, 'Port of Haifa': 6336},\n",
       " 'Port of Vancouver': {'Mina Salman': 15871, 'Port of Haifa': 12461},\n",
       " 'Port of Shanghai': {'Mina Salman': 6882, 'Port of Haifa': 8336},\n",
       " 'Port of Marseille': {'Mina Salman': 5332, 'Port of Haifa': 1946},\n",
       " 'Port of Bandar Abbas': {'Mina Salman': 380, 'Port of Haifa': 3310},\n",
       " 'Port of Haifa': {'Mina Salman': 3621, 'Port of Haifa': 0},\n",
       " 'Port of Aktau': {'Mina Salman': 5279, 'Port of Haifa': 2201},\n",
       " 'Port of Busan': {'Mina Salman': 7398, 'Port of Haifa': 8852},\n",
       " 'Penang Port': {'Mina Salman': 3856, 'Port of Haifa': 5310},\n",
       " 'Port of Oslo': {'Mina Salman': 7928, 'Port of Haifa': 4539},\n",
       " 'Port of Vladivostok': {'Mina Salman': 7981, 'Port of Haifa': 9435},\n",
       " 'Port of Novorossiysk': {'Mina Salman': 5139, 'Port of Haifa': 1715},\n",
       " 'Port of St. Petersburg': {'Mina Salman': 8787, 'Port of Haifa': 5398},\n",
       " 'Port of Belgrade': {'Mina Salman': 5416, 'Port of Haifa': 1994},\n",
       " 'Port of Mersin': {'Mina Salman': 3831, 'Port of Haifa': 233},\n",
       " 'Port of Odessa': {'Mina Salman': 4957, 'Port of Haifa': 1533},\n",
       " 'Port of New York': {'Mina Salman': 9168, 'Port of Haifa': 5756},\n",
       " 'Port of Los Angeles': {'Mina Salman': 14552, 'Port of Haifa': 11048}}"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "distance"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "#Inputing the Magnesium Demand\n",
    "magnesium_demand=dict(zip(demand_points, [220033911.8,191353978.2]))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'Mina Salman': 220033911.8, 'Port of Haifa': 191353978.2}"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "magnesium_demand"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "#Inputing the Magnesium Supply\n",
    "magnesium_supply=dict(zip(supply_points, [4204466.2090,1222172.6320,363811.2924,298590444.7000,2010234.6250,1585983.9250,7566106.3450,6113002.8630,4078244.4230,47579.5177,5189339.4020,9195220.1200,4484984.5940,4536578.4990,379084.0981,3324539.5030,41313949.6100,10124868.6300,7057279.1490])) "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'Port of Santos': 4204466.209,\n",
       " 'Port of Montreal': 1222172.632,\n",
       " 'Port of Vancouver': 363811.2924,\n",
       " 'Port of Shanghai': 298590444.7,\n",
       " 'Port of Marseille': 2010234.625,\n",
       " 'Port of Bandar Abbas': 1585983.925,\n",
       " 'Port of Haifa': 7566106.345,\n",
       " 'Port of Aktau': 6113002.863,\n",
       " 'Port of Busan': 4078244.423,\n",
       " 'Penang Port': 47579.5177,\n",
       " 'Port of Oslo': 5189339.402,\n",
       " 'Port of Vladivostok': 9195220.12,\n",
       " 'Port of Novorossiysk': 4484984.594,\n",
       " 'Port of St. Petersburg': 4536578.499,\n",
       " 'Port of Belgrade': 379084.0981,\n",
       " 'Port of Mersin': 3324539.503,\n",
       " 'Port of Odessa': 41313949.61,\n",
       " 'Port of New York': 10124868.63,\n",
       " 'Port of Los Angeles': 7057279.149}"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "magnesium_supply"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Set Problem Variables\n",
    "prob = LpProblem(\"Transportation\", LpMinimize)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Transportation:\n",
       "MINIMIZE\n",
       "None\n",
       "VARIABLES"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "prob"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Set Problem Variables\n",
    "routes = [(i,j) for i in supply_points for j in demand_points]\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[('Port of Santos', 'Mina Salman'),\n",
       " ('Port of Santos', 'Port of Haifa'),\n",
       " ('Port of Montreal', 'Mina Salman'),\n",
       " ('Port of Montreal', 'Port of Haifa'),\n",
       " ('Port of Vancouver', 'Mina Salman'),\n",
       " ('Port of Vancouver', 'Port of Haifa'),\n",
       " ('Port of Shanghai', 'Mina Salman'),\n",
       " ('Port of Shanghai', 'Port of Haifa'),\n",
       " ('Port of Marseille', 'Mina Salman'),\n",
       " ('Port of Marseille', 'Port of Haifa'),\n",
       " ('Port of Bandar Abbas', 'Mina Salman'),\n",
       " ('Port of Bandar Abbas', 'Port of Haifa'),\n",
       " ('Port of Haifa', 'Mina Salman'),\n",
       " ('Port of Haifa', 'Port of Haifa'),\n",
       " ('Port of Aktau', 'Mina Salman'),\n",
       " ('Port of Aktau', 'Port of Haifa'),\n",
       " ('Port of Busan', 'Mina Salman'),\n",
       " ('Port of Busan', 'Port of Haifa'),\n",
       " ('Penang Port', 'Mina Salman'),\n",
       " ('Penang Port', 'Port of Haifa'),\n",
       " ('Port of Oslo', 'Mina Salman'),\n",
       " ('Port of Oslo', 'Port of Haifa'),\n",
       " ('Port of Vladivostok', 'Mina Salman'),\n",
       " ('Port of Vladivostok', 'Port of Haifa'),\n",
       " ('Port of Novorossiysk', 'Mina Salman'),\n",
       " ('Port of Novorossiysk', 'Port of Haifa'),\n",
       " ('Port of St. Petersburg', 'Mina Salman'),\n",
       " ('Port of St. Petersburg', 'Port of Haifa'),\n",
       " ('Port of Belgrade', 'Mina Salman'),\n",
       " ('Port of Belgrade', 'Port of Haifa'),\n",
       " ('Port of Mersin', 'Mina Salman'),\n",
       " ('Port of Mersin', 'Port of Haifa'),\n",
       " ('Port of Odessa', 'Mina Salman'),\n",
       " ('Port of Odessa', 'Port of Haifa'),\n",
       " ('Port of New York', 'Mina Salman'),\n",
       " ('Port of New York', 'Port of Haifa'),\n",
       " ('Port of Los Angeles', 'Mina Salman'),\n",
       " ('Port of Los Angeles', 'Port of Haifa')]"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "routes"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Decision Variables\n",
    "X = LpVariable.dicts(\"ShipmentAmount\",(supply_points, demand_points),0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'Port of Santos': {'Mina Salman': ShipmentAmount_Port_of_Santos_Mina_Salman,\n",
       "  'Port of Haifa': ShipmentAmount_Port_of_Santos_Port_of_Haifa},\n",
       " 'Port of Montreal': {'Mina Salman': ShipmentAmount_Port_of_Montreal_Mina_Salman,\n",
       "  'Port of Haifa': ShipmentAmount_Port_of_Montreal_Port_of_Haifa},\n",
       " 'Port of Vancouver': {'Mina Salman': ShipmentAmount_Port_of_Vancouver_Mina_Salman,\n",
       "  'Port of Haifa': ShipmentAmount_Port_of_Vancouver_Port_of_Haifa},\n",
       " 'Port of Shanghai': {'Mina Salman': ShipmentAmount_Port_of_Shanghai_Mina_Salman,\n",
       "  'Port of Haifa': ShipmentAmount_Port_of_Shanghai_Port_of_Haifa},\n",
       " 'Port of Marseille': {'Mina Salman': ShipmentAmount_Port_of_Marseille_Mina_Salman,\n",
       "  'Port of Haifa': ShipmentAmount_Port_of_Marseille_Port_of_Haifa},\n",
       " 'Port of Bandar Abbas': {'Mina Salman': ShipmentAmount_Port_of_Bandar_Abbas_Mina_Salman,\n",
       "  'Port of Haifa': ShipmentAmount_Port_of_Bandar_Abbas_Port_of_Haifa},\n",
       " 'Port of Haifa': {'Mina Salman': ShipmentAmount_Port_of_Haifa_Mina_Salman,\n",
       "  'Port of Haifa': ShipmentAmount_Port_of_Haifa_Port_of_Haifa},\n",
       " 'Port of Aktau': {'Mina Salman': ShipmentAmount_Port_of_Aktau_Mina_Salman,\n",
       "  'Port of Haifa': ShipmentAmount_Port_of_Aktau_Port_of_Haifa},\n",
       " 'Port of Busan': {'Mina Salman': ShipmentAmount_Port_of_Busan_Mina_Salman,\n",
       "  'Port of Haifa': ShipmentAmount_Port_of_Busan_Port_of_Haifa},\n",
       " 'Penang Port': {'Mina Salman': ShipmentAmount_Penang_Port_Mina_Salman,\n",
       "  'Port of Haifa': ShipmentAmount_Penang_Port_Port_of_Haifa},\n",
       " 'Port of Oslo': {'Mina Salman': ShipmentAmount_Port_of_Oslo_Mina_Salman,\n",
       "  'Port of Haifa': ShipmentAmount_Port_of_Oslo_Port_of_Haifa},\n",
       " 'Port of Vladivostok': {'Mina Salman': ShipmentAmount_Port_of_Vladivostok_Mina_Salman,\n",
       "  'Port of Haifa': ShipmentAmount_Port_of_Vladivostok_Port_of_Haifa},\n",
       " 'Port of Novorossiysk': {'Mina Salman': ShipmentAmount_Port_of_Novorossiysk_Mina_Salman,\n",
       "  'Port of Haifa': ShipmentAmount_Port_of_Novorossiysk_Port_of_Haifa},\n",
       " 'Port of St. Petersburg': {'Mina Salman': ShipmentAmount_Port_of_St._Petersburg_Mina_Salman,\n",
       "  'Port of Haifa': ShipmentAmount_Port_of_St._Petersburg_Port_of_Haifa},\n",
       " 'Port of Belgrade': {'Mina Salman': ShipmentAmount_Port_of_Belgrade_Mina_Salman,\n",
       "  'Port of Haifa': ShipmentAmount_Port_of_Belgrade_Port_of_Haifa},\n",
       " 'Port of Mersin': {'Mina Salman': ShipmentAmount_Port_of_Mersin_Mina_Salman,\n",
       "  'Port of Haifa': ShipmentAmount_Port_of_Mersin_Port_of_Haifa},\n",
       " 'Port of Odessa': {'Mina Salman': ShipmentAmount_Port_of_Odessa_Mina_Salman,\n",
       "  'Port of Haifa': ShipmentAmount_Port_of_Odessa_Port_of_Haifa},\n",
       " 'Port of New York': {'Mina Salman': ShipmentAmount_Port_of_New_York_Mina_Salman,\n",
       "  'Port of Haifa': ShipmentAmount_Port_of_New_York_Port_of_Haifa},\n",
       " 'Port of Los Angeles': {'Mina Salman': ShipmentAmount_Port_of_Los_Angeles_Mina_Salman,\n",
       "  'Port of Haifa': ShipmentAmount_Port_of_Los_Angeles_Port_of_Haifa}}"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Objective Function\n",
    "prob += sum(X[i][j]*distance[i][j] for (i,j) in routes)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Transportation:\n",
       "MINIMIZE\n",
       "3856*ShipmentAmount_Penang_Port_Mina_Salman + 5310*ShipmentAmount_Penang_Port_Port_of_Haifa + 5279*ShipmentAmount_Port_of_Aktau_Mina_Salman + 2201*ShipmentAmount_Port_of_Aktau_Port_of_Haifa + 380*ShipmentAmount_Port_of_Bandar_Abbas_Mina_Salman + 3310*ShipmentAmount_Port_of_Bandar_Abbas_Port_of_Haifa + 5416*ShipmentAmount_Port_of_Belgrade_Mina_Salman + 1994*ShipmentAmount_Port_of_Belgrade_Port_of_Haifa + 7398*ShipmentAmount_Port_of_Busan_Mina_Salman + 8852*ShipmentAmount_Port_of_Busan_Port_of_Haifa + 3621*ShipmentAmount_Port_of_Haifa_Mina_Salman + 14552*ShipmentAmount_Port_of_Los_Angeles_Mina_Salman + 11048*ShipmentAmount_Port_of_Los_Angeles_Port_of_Haifa + 5332*ShipmentAmount_Port_of_Marseille_Mina_Salman + 1946*ShipmentAmount_Port_of_Marseille_Port_of_Haifa + 3831*ShipmentAmount_Port_of_Mersin_Mina_Salman + 233*ShipmentAmount_Port_of_Mersin_Port_of_Haifa + 9594*ShipmentAmount_Port_of_Montreal_Mina_Salman + 6336*ShipmentAmount_Port_of_Montreal_Port_of_Haifa + 9168*ShipmentAmount_Port_of_New_York_Mina_Salman + 5756*ShipmentAmount_Port_of_New_York_Port_of_Haifa + 5139*ShipmentAmount_Port_of_Novorossiysk_Mina_Salman + 1715*ShipmentAmount_Port_of_Novorossiysk_Port_of_Haifa + 4957*ShipmentAmount_Port_of_Odessa_Mina_Salman + 1533*ShipmentAmount_Port_of_Odessa_Port_of_Haifa + 7928*ShipmentAmount_Port_of_Oslo_Mina_Salman + 4539*ShipmentAmount_Port_of_Oslo_Port_of_Haifa + 9662*ShipmentAmount_Port_of_Santos_Mina_Salman + 7667*ShipmentAmount_Port_of_Santos_Port_of_Haifa + 6882*ShipmentAmount_Port_of_Shanghai_Mina_Salman + 8336*ShipmentAmount_Port_of_Shanghai_Port_of_Haifa + 8787*ShipmentAmount_Port_of_St._Petersburg_Mina_Salman + 5398*ShipmentAmount_Port_of_St._Petersburg_Port_of_Haifa + 15871*ShipmentAmount_Port_of_Vancouver_Mina_Salman + 12461*ShipmentAmount_Port_of_Vancouver_Port_of_Haifa + 7981*ShipmentAmount_Port_of_Vladivostok_Mina_Salman + 9435*ShipmentAmount_Port_of_Vladivostok_Port_of_Haifa + 0\n",
       "VARIABLES\n",
       "ShipmentAmount_Penang_Port_Mina_Salman Continuous\n",
       "ShipmentAmount_Penang_Port_Port_of_Haifa Continuous\n",
       "ShipmentAmount_Port_of_Aktau_Mina_Salman Continuous\n",
       "ShipmentAmount_Port_of_Aktau_Port_of_Haifa Continuous\n",
       "ShipmentAmount_Port_of_Bandar_Abbas_Mina_Salman Continuous\n",
       "ShipmentAmount_Port_of_Bandar_Abbas_Port_of_Haifa Continuous\n",
       "ShipmentAmount_Port_of_Belgrade_Mina_Salman Continuous\n",
       "ShipmentAmount_Port_of_Belgrade_Port_of_Haifa Continuous\n",
       "ShipmentAmount_Port_of_Busan_Mina_Salman Continuous\n",
       "ShipmentAmount_Port_of_Busan_Port_of_Haifa Continuous\n",
       "ShipmentAmount_Port_of_Haifa_Mina_Salman Continuous\n",
       "ShipmentAmount_Port_of_Los_Angeles_Mina_Salman Continuous\n",
       "ShipmentAmount_Port_of_Los_Angeles_Port_of_Haifa Continuous\n",
       "ShipmentAmount_Port_of_Marseille_Mina_Salman Continuous\n",
       "ShipmentAmount_Port_of_Marseille_Port_of_Haifa Continuous\n",
       "ShipmentAmount_Port_of_Mersin_Mina_Salman Continuous\n",
       "ShipmentAmount_Port_of_Mersin_Port_of_Haifa Continuous\n",
       "ShipmentAmount_Port_of_Montreal_Mina_Salman Continuous\n",
       "ShipmentAmount_Port_of_Montreal_Port_of_Haifa Continuous\n",
       "ShipmentAmount_Port_of_New_York_Mina_Salman Continuous\n",
       "ShipmentAmount_Port_of_New_York_Port_of_Haifa Continuous\n",
       "ShipmentAmount_Port_of_Novorossiysk_Mina_Salman Continuous\n",
       "ShipmentAmount_Port_of_Novorossiysk_Port_of_Haifa Continuous\n",
       "ShipmentAmount_Port_of_Odessa_Mina_Salman Continuous\n",
       "ShipmentAmount_Port_of_Odessa_Port_of_Haifa Continuous\n",
       "ShipmentAmount_Port_of_Oslo_Mina_Salman Continuous\n",
       "ShipmentAmount_Port_of_Oslo_Port_of_Haifa Continuous\n",
       "ShipmentAmount_Port_of_Santos_Mina_Salman Continuous\n",
       "ShipmentAmount_Port_of_Santos_Port_of_Haifa Continuous\n",
       "ShipmentAmount_Port_of_Shanghai_Mina_Salman Continuous\n",
       "ShipmentAmount_Port_of_Shanghai_Port_of_Haifa Continuous\n",
       "ShipmentAmount_Port_of_St._Petersburg_Mina_Salman Continuous\n",
       "ShipmentAmount_Port_of_St._Petersburg_Port_of_Haifa Continuous\n",
       "ShipmentAmount_Port_of_Vancouver_Mina_Salman Continuous\n",
       "ShipmentAmount_Port_of_Vancouver_Port_of_Haifa Continuous\n",
       "ShipmentAmount_Port_of_Vladivostok_Mina_Salman Continuous\n",
       "ShipmentAmount_Port_of_Vladivostok_Port_of_Haifa Continuous"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "prob"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Transportation:\n",
       "MINIMIZE\n",
       "3856*ShipmentAmount_Penang_Port_Mina_Salman + 5310*ShipmentAmount_Penang_Port_Port_of_Haifa + 5279*ShipmentAmount_Port_of_Aktau_Mina_Salman + 2201*ShipmentAmount_Port_of_Aktau_Port_of_Haifa + 380*ShipmentAmount_Port_of_Bandar_Abbas_Mina_Salman + 3310*ShipmentAmount_Port_of_Bandar_Abbas_Port_of_Haifa + 5416*ShipmentAmount_Port_of_Belgrade_Mina_Salman + 1994*ShipmentAmount_Port_of_Belgrade_Port_of_Haifa + 7398*ShipmentAmount_Port_of_Busan_Mina_Salman + 8852*ShipmentAmount_Port_of_Busan_Port_of_Haifa + 3621*ShipmentAmount_Port_of_Haifa_Mina_Salman + 14552*ShipmentAmount_Port_of_Los_Angeles_Mina_Salman + 11048*ShipmentAmount_Port_of_Los_Angeles_Port_of_Haifa + 5332*ShipmentAmount_Port_of_Marseille_Mina_Salman + 1946*ShipmentAmount_Port_of_Marseille_Port_of_Haifa + 3831*ShipmentAmount_Port_of_Mersin_Mina_Salman + 233*ShipmentAmount_Port_of_Mersin_Port_of_Haifa + 9594*ShipmentAmount_Port_of_Montreal_Mina_Salman + 6336*ShipmentAmount_Port_of_Montreal_Port_of_Haifa + 9168*ShipmentAmount_Port_of_New_York_Mina_Salman + 5756*ShipmentAmount_Port_of_New_York_Port_of_Haifa + 5139*ShipmentAmount_Port_of_Novorossiysk_Mina_Salman + 1715*ShipmentAmount_Port_of_Novorossiysk_Port_of_Haifa + 4957*ShipmentAmount_Port_of_Odessa_Mina_Salman + 1533*ShipmentAmount_Port_of_Odessa_Port_of_Haifa + 7928*ShipmentAmount_Port_of_Oslo_Mina_Salman + 4539*ShipmentAmount_Port_of_Oslo_Port_of_Haifa + 9662*ShipmentAmount_Port_of_Santos_Mina_Salman + 7667*ShipmentAmount_Port_of_Santos_Port_of_Haifa + 6882*ShipmentAmount_Port_of_Shanghai_Mina_Salman + 8336*ShipmentAmount_Port_of_Shanghai_Port_of_Haifa + 8787*ShipmentAmount_Port_of_St._Petersburg_Mina_Salman + 5398*ShipmentAmount_Port_of_St._Petersburg_Port_of_Haifa + 15871*ShipmentAmount_Port_of_Vancouver_Mina_Salman + 12461*ShipmentAmount_Port_of_Vancouver_Port_of_Haifa + 7981*ShipmentAmount_Port_of_Vladivostok_Mina_Salman + 9435*ShipmentAmount_Port_of_Vladivostok_Port_of_Haifa + 0\n",
       "SUBJECT TO\n",
       "_C1: ShipmentAmount_Penang_Port_Mina_Salman\n",
       " + ShipmentAmount_Port_of_Aktau_Mina_Salman\n",
       " + ShipmentAmount_Port_of_Bandar_Abbas_Mina_Salman\n",
       " + ShipmentAmount_Port_of_Belgrade_Mina_Salman\n",
       " + ShipmentAmount_Port_of_Busan_Mina_Salman\n",
       " + ShipmentAmount_Port_of_Haifa_Mina_Salman\n",
       " + ShipmentAmount_Port_of_Los_Angeles_Mina_Salman\n",
       " + ShipmentAmount_Port_of_Marseille_Mina_Salman\n",
       " + ShipmentAmount_Port_of_Mersin_Mina_Salman\n",
       " + ShipmentAmount_Port_of_Montreal_Mina_Salman\n",
       " + ShipmentAmount_Port_of_New_York_Mina_Salman\n",
       " + ShipmentAmount_Port_of_Novorossiysk_Mina_Salman\n",
       " + ShipmentAmount_Port_of_Odessa_Mina_Salman\n",
       " + ShipmentAmount_Port_of_Oslo_Mina_Salman\n",
       " + ShipmentAmount_Port_of_Santos_Mina_Salman\n",
       " + ShipmentAmount_Port_of_Shanghai_Mina_Salman\n",
       " + ShipmentAmount_Port_of_St._Petersburg_Mina_Salman\n",
       " + ShipmentAmount_Port_of_Vancouver_Mina_Salman\n",
       " + ShipmentAmount_Port_of_Vladivostok_Mina_Salman >= 220033911.8\n",
       "\n",
       "_C2: ShipmentAmount_Penang_Port_Port_of_Haifa\n",
       " + ShipmentAmount_Port_of_Aktau_Port_of_Haifa\n",
       " + ShipmentAmount_Port_of_Bandar_Abbas_Port_of_Haifa\n",
       " + ShipmentAmount_Port_of_Belgrade_Port_of_Haifa\n",
       " + ShipmentAmount_Port_of_Busan_Port_of_Haifa\n",
       " + ShipmentAmount_Port_of_Haifa_Port_of_Haifa\n",
       " + ShipmentAmount_Port_of_Los_Angeles_Port_of_Haifa\n",
       " + ShipmentAmount_Port_of_Marseille_Port_of_Haifa\n",
       " + ShipmentAmount_Port_of_Mersin_Port_of_Haifa\n",
       " + ShipmentAmount_Port_of_Montreal_Port_of_Haifa\n",
       " + ShipmentAmount_Port_of_New_York_Port_of_Haifa\n",
       " + ShipmentAmount_Port_of_Novorossiysk_Port_of_Haifa\n",
       " + ShipmentAmount_Port_of_Odessa_Port_of_Haifa\n",
       " + ShipmentAmount_Port_of_Oslo_Port_of_Haifa\n",
       " + ShipmentAmount_Port_of_Santos_Port_of_Haifa\n",
       " + ShipmentAmount_Port_of_Shanghai_Port_of_Haifa\n",
       " + ShipmentAmount_Port_of_St._Petersburg_Port_of_Haifa\n",
       " + ShipmentAmount_Port_of_Vancouver_Port_of_Haifa\n",
       " + ShipmentAmount_Port_of_Vladivostok_Port_of_Haifa >= 191353978.2\n",
       "\n",
       "VARIABLES\n",
       "ShipmentAmount_Penang_Port_Mina_Salman Continuous\n",
       "ShipmentAmount_Penang_Port_Port_of_Haifa Continuous\n",
       "ShipmentAmount_Port_of_Aktau_Mina_Salman Continuous\n",
       "ShipmentAmount_Port_of_Aktau_Port_of_Haifa Continuous\n",
       "ShipmentAmount_Port_of_Bandar_Abbas_Mina_Salman Continuous\n",
       "ShipmentAmount_Port_of_Bandar_Abbas_Port_of_Haifa Continuous\n",
       "ShipmentAmount_Port_of_Belgrade_Mina_Salman Continuous\n",
       "ShipmentAmount_Port_of_Belgrade_Port_of_Haifa Continuous\n",
       "ShipmentAmount_Port_of_Busan_Mina_Salman Continuous\n",
       "ShipmentAmount_Port_of_Busan_Port_of_Haifa Continuous\n",
       "ShipmentAmount_Port_of_Haifa_Mina_Salman Continuous\n",
       "ShipmentAmount_Port_of_Haifa_Port_of_Haifa Continuous\n",
       "ShipmentAmount_Port_of_Los_Angeles_Mina_Salman Continuous\n",
       "ShipmentAmount_Port_of_Los_Angeles_Port_of_Haifa Continuous\n",
       "ShipmentAmount_Port_of_Marseille_Mina_Salman Continuous\n",
       "ShipmentAmount_Port_of_Marseille_Port_of_Haifa Continuous\n",
       "ShipmentAmount_Port_of_Mersin_Mina_Salman Continuous\n",
       "ShipmentAmount_Port_of_Mersin_Port_of_Haifa Continuous\n",
       "ShipmentAmount_Port_of_Montreal_Mina_Salman Continuous\n",
       "ShipmentAmount_Port_of_Montreal_Port_of_Haifa Continuous\n",
       "ShipmentAmount_Port_of_New_York_Mina_Salman Continuous\n",
       "ShipmentAmount_Port_of_New_York_Port_of_Haifa Continuous\n",
       "ShipmentAmount_Port_of_Novorossiysk_Mina_Salman Continuous\n",
       "ShipmentAmount_Port_of_Novorossiysk_Port_of_Haifa Continuous\n",
       "ShipmentAmount_Port_of_Odessa_Mina_Salman Continuous\n",
       "ShipmentAmount_Port_of_Odessa_Port_of_Haifa Continuous\n",
       "ShipmentAmount_Port_of_Oslo_Mina_Salman Continuous\n",
       "ShipmentAmount_Port_of_Oslo_Port_of_Haifa Continuous\n",
       "ShipmentAmount_Port_of_Santos_Mina_Salman Continuous\n",
       "ShipmentAmount_Port_of_Santos_Port_of_Haifa Continuous\n",
       "ShipmentAmount_Port_of_Shanghai_Mina_Salman Continuous\n",
       "ShipmentAmount_Port_of_Shanghai_Port_of_Haifa Continuous\n",
       "ShipmentAmount_Port_of_St._Petersburg_Mina_Salman Continuous\n",
       "ShipmentAmount_Port_of_St._Petersburg_Port_of_Haifa Continuous\n",
       "ShipmentAmount_Port_of_Vancouver_Mina_Salman Continuous\n",
       "ShipmentAmount_Port_of_Vancouver_Port_of_Haifa Continuous\n",
       "ShipmentAmount_Port_of_Vladivostok_Mina_Salman Continuous\n",
       "ShipmentAmount_Port_of_Vladivostok_Port_of_Haifa Continuous"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Constraints\n",
    "for j in demand_points:\n",
    "    prob += sum(X[i][j] for i in supply_points) >= magnesium_demand[j]\n",
    "    \n",
    "prob"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Transportation:\n",
       "MINIMIZE\n",
       "3856*ShipmentAmount_Penang_Port_Mina_Salman + 5310*ShipmentAmount_Penang_Port_Port_of_Haifa + 5279*ShipmentAmount_Port_of_Aktau_Mina_Salman + 2201*ShipmentAmount_Port_of_Aktau_Port_of_Haifa + 380*ShipmentAmount_Port_of_Bandar_Abbas_Mina_Salman + 3310*ShipmentAmount_Port_of_Bandar_Abbas_Port_of_Haifa + 5416*ShipmentAmount_Port_of_Belgrade_Mina_Salman + 1994*ShipmentAmount_Port_of_Belgrade_Port_of_Haifa + 7398*ShipmentAmount_Port_of_Busan_Mina_Salman + 8852*ShipmentAmount_Port_of_Busan_Port_of_Haifa + 3621*ShipmentAmount_Port_of_Haifa_Mina_Salman + 14552*ShipmentAmount_Port_of_Los_Angeles_Mina_Salman + 11048*ShipmentAmount_Port_of_Los_Angeles_Port_of_Haifa + 5332*ShipmentAmount_Port_of_Marseille_Mina_Salman + 1946*ShipmentAmount_Port_of_Marseille_Port_of_Haifa + 3831*ShipmentAmount_Port_of_Mersin_Mina_Salman + 233*ShipmentAmount_Port_of_Mersin_Port_of_Haifa + 9594*ShipmentAmount_Port_of_Montreal_Mina_Salman + 6336*ShipmentAmount_Port_of_Montreal_Port_of_Haifa + 9168*ShipmentAmount_Port_of_New_York_Mina_Salman + 5756*ShipmentAmount_Port_of_New_York_Port_of_Haifa + 5139*ShipmentAmount_Port_of_Novorossiysk_Mina_Salman + 1715*ShipmentAmount_Port_of_Novorossiysk_Port_of_Haifa + 4957*ShipmentAmount_Port_of_Odessa_Mina_Salman + 1533*ShipmentAmount_Port_of_Odessa_Port_of_Haifa + 7928*ShipmentAmount_Port_of_Oslo_Mina_Salman + 4539*ShipmentAmount_Port_of_Oslo_Port_of_Haifa + 9662*ShipmentAmount_Port_of_Santos_Mina_Salman + 7667*ShipmentAmount_Port_of_Santos_Port_of_Haifa + 6882*ShipmentAmount_Port_of_Shanghai_Mina_Salman + 8336*ShipmentAmount_Port_of_Shanghai_Port_of_Haifa + 8787*ShipmentAmount_Port_of_St._Petersburg_Mina_Salman + 5398*ShipmentAmount_Port_of_St._Petersburg_Port_of_Haifa + 15871*ShipmentAmount_Port_of_Vancouver_Mina_Salman + 12461*ShipmentAmount_Port_of_Vancouver_Port_of_Haifa + 7981*ShipmentAmount_Port_of_Vladivostok_Mina_Salman + 9435*ShipmentAmount_Port_of_Vladivostok_Port_of_Haifa + 0\n",
       "SUBJECT TO\n",
       "_C1: ShipmentAmount_Penang_Port_Mina_Salman\n",
       " + ShipmentAmount_Port_of_Aktau_Mina_Salman\n",
       " + ShipmentAmount_Port_of_Bandar_Abbas_Mina_Salman\n",
       " + ShipmentAmount_Port_of_Belgrade_Mina_Salman\n",
       " + ShipmentAmount_Port_of_Busan_Mina_Salman\n",
       " + ShipmentAmount_Port_of_Haifa_Mina_Salman\n",
       " + ShipmentAmount_Port_of_Los_Angeles_Mina_Salman\n",
       " + ShipmentAmount_Port_of_Marseille_Mina_Salman\n",
       " + ShipmentAmount_Port_of_Mersin_Mina_Salman\n",
       " + ShipmentAmount_Port_of_Montreal_Mina_Salman\n",
       " + ShipmentAmount_Port_of_New_York_Mina_Salman\n",
       " + ShipmentAmount_Port_of_Novorossiysk_Mina_Salman\n",
       " + ShipmentAmount_Port_of_Odessa_Mina_Salman\n",
       " + ShipmentAmount_Port_of_Oslo_Mina_Salman\n",
       " + ShipmentAmount_Port_of_Santos_Mina_Salman\n",
       " + ShipmentAmount_Port_of_Shanghai_Mina_Salman\n",
       " + ShipmentAmount_Port_of_St._Petersburg_Mina_Salman\n",
       " + ShipmentAmount_Port_of_Vancouver_Mina_Salman\n",
       " + ShipmentAmount_Port_of_Vladivostok_Mina_Salman >= 220033911.8\n",
       "\n",
       "_C2: ShipmentAmount_Penang_Port_Port_of_Haifa\n",
       " + ShipmentAmount_Port_of_Aktau_Port_of_Haifa\n",
       " + ShipmentAmount_Port_of_Bandar_Abbas_Port_of_Haifa\n",
       " + ShipmentAmount_Port_of_Belgrade_Port_of_Haifa\n",
       " + ShipmentAmount_Port_of_Busan_Port_of_Haifa\n",
       " + ShipmentAmount_Port_of_Haifa_Port_of_Haifa\n",
       " + ShipmentAmount_Port_of_Los_Angeles_Port_of_Haifa\n",
       " + ShipmentAmount_Port_of_Marseille_Port_of_Haifa\n",
       " + ShipmentAmount_Port_of_Mersin_Port_of_Haifa\n",
       " + ShipmentAmount_Port_of_Montreal_Port_of_Haifa\n",
       " + ShipmentAmount_Port_of_New_York_Port_of_Haifa\n",
       " + ShipmentAmount_Port_of_Novorossiysk_Port_of_Haifa\n",
       " + ShipmentAmount_Port_of_Odessa_Port_of_Haifa\n",
       " + ShipmentAmount_Port_of_Oslo_Port_of_Haifa\n",
       " + ShipmentAmount_Port_of_Santos_Port_of_Haifa\n",
       " + ShipmentAmount_Port_of_Shanghai_Port_of_Haifa\n",
       " + ShipmentAmount_Port_of_St._Petersburg_Port_of_Haifa\n",
       " + ShipmentAmount_Port_of_Vancouver_Port_of_Haifa\n",
       " + ShipmentAmount_Port_of_Vladivostok_Port_of_Haifa >= 191353978.2\n",
       "\n",
       "_C3: ShipmentAmount_Port_of_Santos_Mina_Salman\n",
       " + ShipmentAmount_Port_of_Santos_Port_of_Haifa = 4204466.209\n",
       "\n",
       "_C4: ShipmentAmount_Port_of_Montreal_Mina_Salman\n",
       " + ShipmentAmount_Port_of_Montreal_Port_of_Haifa = 1222172.632\n",
       "\n",
       "_C5: ShipmentAmount_Port_of_Vancouver_Mina_Salman\n",
       " + ShipmentAmount_Port_of_Vancouver_Port_of_Haifa = 363811.2924\n",
       "\n",
       "_C6: ShipmentAmount_Port_of_Shanghai_Mina_Salman\n",
       " + ShipmentAmount_Port_of_Shanghai_Port_of_Haifa = 298590444.7\n",
       "\n",
       "_C7: ShipmentAmount_Port_of_Marseille_Mina_Salman\n",
       " + ShipmentAmount_Port_of_Marseille_Port_of_Haifa = 2010234.625\n",
       "\n",
       "_C8: ShipmentAmount_Port_of_Bandar_Abbas_Mina_Salman\n",
       " + ShipmentAmount_Port_of_Bandar_Abbas_Port_of_Haifa = 1585983.925\n",
       "\n",
       "_C9: ShipmentAmount_Port_of_Haifa_Mina_Salman\n",
       " + ShipmentAmount_Port_of_Haifa_Port_of_Haifa = 7566106.345\n",
       "\n",
       "_C10: ShipmentAmount_Port_of_Aktau_Mina_Salman\n",
       " + ShipmentAmount_Port_of_Aktau_Port_of_Haifa = 6113002.863\n",
       "\n",
       "_C11: ShipmentAmount_Port_of_Busan_Mina_Salman\n",
       " + ShipmentAmount_Port_of_Busan_Port_of_Haifa = 4078244.423\n",
       "\n",
       "_C12: ShipmentAmount_Penang_Port_Mina_Salman\n",
       " + ShipmentAmount_Penang_Port_Port_of_Haifa = 47579.5177\n",
       "\n",
       "_C13: ShipmentAmount_Port_of_Oslo_Mina_Salman\n",
       " + ShipmentAmount_Port_of_Oslo_Port_of_Haifa = 5189339.402\n",
       "\n",
       "_C14: ShipmentAmount_Port_of_Vladivostok_Mina_Salman\n",
       " + ShipmentAmount_Port_of_Vladivostok_Port_of_Haifa = 9195220.12\n",
       "\n",
       "_C15: ShipmentAmount_Port_of_Novorossiysk_Mina_Salman\n",
       " + ShipmentAmount_Port_of_Novorossiysk_Port_of_Haifa = 4484984.594\n",
       "\n",
       "_C16: ShipmentAmount_Port_of_St._Petersburg_Mina_Salman\n",
       " + ShipmentAmount_Port_of_St._Petersburg_Port_of_Haifa = 4536578.499\n",
       "\n",
       "_C17: ShipmentAmount_Port_of_Belgrade_Mina_Salman\n",
       " + ShipmentAmount_Port_of_Belgrade_Port_of_Haifa = 379084.0981\n",
       "\n",
       "_C18: ShipmentAmount_Port_of_Mersin_Mina_Salman\n",
       " + ShipmentAmount_Port_of_Mersin_Port_of_Haifa = 3324539.503\n",
       "\n",
       "_C19: ShipmentAmount_Port_of_Odessa_Mina_Salman\n",
       " + ShipmentAmount_Port_of_Odessa_Port_of_Haifa = 41313949.61\n",
       "\n",
       "_C20: ShipmentAmount_Port_of_New_York_Mina_Salman\n",
       " + ShipmentAmount_Port_of_New_York_Port_of_Haifa = 10124868.63\n",
       "\n",
       "_C21: ShipmentAmount_Port_of_Los_Angeles_Mina_Salman\n",
       " + ShipmentAmount_Port_of_Los_Angeles_Port_of_Haifa = 7057279.149\n",
       "\n",
       "VARIABLES\n",
       "ShipmentAmount_Penang_Port_Mina_Salman Continuous\n",
       "ShipmentAmount_Penang_Port_Port_of_Haifa Continuous\n",
       "ShipmentAmount_Port_of_Aktau_Mina_Salman Continuous\n",
       "ShipmentAmount_Port_of_Aktau_Port_of_Haifa Continuous\n",
       "ShipmentAmount_Port_of_Bandar_Abbas_Mina_Salman Continuous\n",
       "ShipmentAmount_Port_of_Bandar_Abbas_Port_of_Haifa Continuous\n",
       "ShipmentAmount_Port_of_Belgrade_Mina_Salman Continuous\n",
       "ShipmentAmount_Port_of_Belgrade_Port_of_Haifa Continuous\n",
       "ShipmentAmount_Port_of_Busan_Mina_Salman Continuous\n",
       "ShipmentAmount_Port_of_Busan_Port_of_Haifa Continuous\n",
       "ShipmentAmount_Port_of_Haifa_Mina_Salman Continuous\n",
       "ShipmentAmount_Port_of_Haifa_Port_of_Haifa Continuous\n",
       "ShipmentAmount_Port_of_Los_Angeles_Mina_Salman Continuous\n",
       "ShipmentAmount_Port_of_Los_Angeles_Port_of_Haifa Continuous\n",
       "ShipmentAmount_Port_of_Marseille_Mina_Salman Continuous\n",
       "ShipmentAmount_Port_of_Marseille_Port_of_Haifa Continuous\n",
       "ShipmentAmount_Port_of_Mersin_Mina_Salman Continuous\n",
       "ShipmentAmount_Port_of_Mersin_Port_of_Haifa Continuous\n",
       "ShipmentAmount_Port_of_Montreal_Mina_Salman Continuous\n",
       "ShipmentAmount_Port_of_Montreal_Port_of_Haifa Continuous\n",
       "ShipmentAmount_Port_of_New_York_Mina_Salman Continuous\n",
       "ShipmentAmount_Port_of_New_York_Port_of_Haifa Continuous\n",
       "ShipmentAmount_Port_of_Novorossiysk_Mina_Salman Continuous\n",
       "ShipmentAmount_Port_of_Novorossiysk_Port_of_Haifa Continuous\n",
       "ShipmentAmount_Port_of_Odessa_Mina_Salman Continuous\n",
       "ShipmentAmount_Port_of_Odessa_Port_of_Haifa Continuous\n",
       "ShipmentAmount_Port_of_Oslo_Mina_Salman Continuous\n",
       "ShipmentAmount_Port_of_Oslo_Port_of_Haifa Continuous\n",
       "ShipmentAmount_Port_of_Santos_Mina_Salman Continuous\n",
       "ShipmentAmount_Port_of_Santos_Port_of_Haifa Continuous\n",
       "ShipmentAmount_Port_of_Shanghai_Mina_Salman Continuous\n",
       "ShipmentAmount_Port_of_Shanghai_Port_of_Haifa Continuous\n",
       "ShipmentAmount_Port_of_St._Petersburg_Mina_Salman Continuous\n",
       "ShipmentAmount_Port_of_St._Petersburg_Port_of_Haifa Continuous\n",
       "ShipmentAmount_Port_of_Vancouver_Mina_Salman Continuous\n",
       "ShipmentAmount_Port_of_Vancouver_Port_of_Haifa Continuous\n",
       "ShipmentAmount_Port_of_Vladivostok_Mina_Salman Continuous\n",
       "ShipmentAmount_Port_of_Vladivostok_Port_of_Haifa Continuous"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Constraints\n",
    "for i in supply_points:\n",
    "    prob += sum(X[i][j] for j in demand_points) == magnesium_supply[i]\n",
    "prob"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Status: Optimal\n",
      "ShipmentAmount_Penang_Port_Port_of_Haifa = 47579.518\n",
      "ShipmentAmount_Port_of_Aktau_Port_of_Haifa = 6113002.9\n",
      "ShipmentAmount_Port_of_Bandar_Abbas_Mina_Salman = 1585983.9\n",
      "ShipmentAmount_Port_of_Belgrade_Port_of_Haifa = 379084.1\n",
      "ShipmentAmount_Port_of_Busan_Port_of_Haifa = 4078244.4\n",
      "ShipmentAmount_Port_of_Haifa_Port_of_Haifa = 7566106.3\n",
      "ShipmentAmount_Port_of_Los_Angeles_Port_of_Haifa = 7057279.1\n",
      "ShipmentAmount_Port_of_Marseille_Port_of_Haifa = 2010234.6\n",
      "ShipmentAmount_Port_of_Mersin_Port_of_Haifa = 3324539.5\n",
      "ShipmentAmount_Port_of_Montreal_Port_of_Haifa = 1222172.6\n",
      "ShipmentAmount_Port_of_New_York_Port_of_Haifa = 10124869.0\n",
      "ShipmentAmount_Port_of_Novorossiysk_Port_of_Haifa = 4484984.6\n",
      "ShipmentAmount_Port_of_Odessa_Port_of_Haifa = 41313950.0\n",
      "ShipmentAmount_Port_of_Oslo_Port_of_Haifa = 5189339.4\n",
      "ShipmentAmount_Port_of_Santos_Port_of_Haifa = 4204466.2\n",
      "ShipmentAmount_Port_of_Shanghai_Mina_Salman = 218447930.0\n",
      "ShipmentAmount_Port_of_Shanghai_Port_of_Haifa = 80142517.0\n",
      "ShipmentAmount_Port_of_St._Petersburg_Port_of_Haifa = 4536578.5\n",
      "ShipmentAmount_Port_of_Vancouver_Port_of_Haifa = 363811.29\n",
      "ShipmentAmount_Port_of_Vladivostok_Port_of_Haifa = 9195220.1\n",
      "Total kilogram_miles = 2613865907593.3696\n"
     ]
    }
   ],
   "source": [
    "prob.solve()\n",
    "\n",
    "print(\"Status:\", LpStatus[prob.status])\n",
    "\n",
    "for v in prob.variables():\n",
    "    if v.varValue > 0:\n",
    "        print(v.name, \"=\", v.varValue)\n",
    "\n",
    "print(\"Total kilogram_miles =\", value(prob.objective))\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
